package org.rafal.springframework.domain;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Version;

/**
 * Simple class Text stores users homework.
 * 
 * @author Rafal
 * 
 */
@Entity
@NamedQueries({
		@NamedQuery(name = "text.findAll", query = "from Text"),
		@NamedQuery(name = "text.findBySubject", query = "select distinct t from Text t where t.subject = :subject") })
public class Text implements Serializable {

	public Text() {
	}

	public Text(String subject, String content) {
		this.subject = subject;
		this.content = content;
	}

	private static final long serialVersionUID = -950435384892204124L;
	private Long id;
	private int version;
	private String subject;
	private String content;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	@Version
	public int getVersion() {
		return version;
	}

	public String getSubject() {
		return subject;
	}

	public String getContent() {
		return content;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public void setContent(String content) {
		this.content = content;
	}

}
